/*
package com.authine.cloudpivot.ext.controller;


import cn.hutool.core.map.MapUtil;
import com.alibaba.dubbo.config.annotation.Reference;
import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.engine.api.model.ResponseResult;
import com.authine.cloudpivot.engine.api.model.organization.UserModel;
import com.authine.cloudpivot.engine.api.model.permission.AdminModel;
import com.authine.cloudpivot.engine.api.model.runtime.BizObjectCreatedModel;
import com.authine.cloudpivot.engine.api.model.runtime.SelectionValue;
import com.authine.cloudpivot.ext.facade.dubbo.CustomerFacade;
import com.authine.cloudpivot.web.api.controller.base.BaseController;
import lombok.extern.slf4j.Slf4j;
import org.apache.tools.ant.util.DateUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.*;
//作废了
@RequestMapping("/api/hrmre")
@RestController
@Slf4j
public class HrmresourceSummaryController extends BaseController {

    */
/**
     * 自定义RPC
     *
     *//*

    @Reference(version = CustomerFacade.VER)
    private CustomerFacade customerFacade;

    @RequestMapping("/hrmresHj")
    public void hrmresHj(String id) {
        //获取 表单数据
        BizObjectCreatedModel bizObject = getBizObjectFacade().getBizObject("PM_hrmresource", id);

        if (bizObject == null) {
            log.info("表单数据为空");
            return ;
        }
        log.info("bizObject:{}", JSON.toJSONString(bizObject));

        //获取子表数据
        Object proObj = bizObject.get("dt_project");
        if (proObj != null) {

//            log.info("proObj:{}", JSON.toJSONString(proObj));

            List<Map<String,Object>> proList = (List<Map<String, Object>>) proObj;

            for (Map<String,Object> m : proList) {
                execData(m,bizObject);
            }
        }else{
            log.info("表单子表数据为空");
        }

    }



    private void execData(Map<String, Object> biz,BizObjectCreatedModel bizObject) {


        log.info("biz:{}",JSON.toJSONString(biz));

        Map<String,Object> pm = (Map<String, Object>) biz.get("project");

        if (pm == null || pm.isEmpty()) {
            log.info("项目为空.......\n");
            return;
        }
        String project = (String) pm.get("id");

        String inputDate = DateUtils.format(new Date(),"yyyy-MM");
        BigDecimal hour = (BigDecimal) biz.get("hour");
        if (hour == null) {
            hour = BigDecimal.ZERO;
        }


        //根据条件获取 项目卡片-人力投入汇总(PM_HR_summary_card) 数据, 存在则 修改, 不存在 添加
        String tableName = getBizObjectFacade().getTableName("PM_HR_summary_card");
        String sql = "select id,PM,hour from "+tableName+" where PM= :PM and Date_format(Date1598003645973,'%Y-%m') = :Date1598003645973 ";
        Map<String, Object> map = MapUtil.builder(new HashMap<String,Object>()).put("sql", sql)
                .put("parameter",MapUtil.builder(new HashMap<String,Object>()).put("PM", project).put("Date1598003645973",inputDate).build())
                .build();

        ResponseResult result = customerFacade.queryByMap(map);

        log.info("123213=={}",result);

        if ( 0 == result.getErrcode() ){
            List<Map<String, Object>> data = (List<Map<String, Object>>) result.getData();


            HashMap<String, Object> bizMap = new HashMap<>();

            bizMap.put("PM",pm);
            bizMap.put("Date1598003645973",inputDate);

            BizObjectCreatedModel bizModel = new BizObjectCreatedModel("PM_HR_summary_card", bizMap, false);
            SelectionValue creater = bizObject.getCreater();
            if (data != null && data.size()>0){
                //修改
                String id = (String) data.get(0).get("id");
                BigDecimal hourCount = (BigDecimal) data.get(0).get("hour");
                if (hourCount == null) {
                    hourCount = BigDecimal.ZERO;
                }
                bizModel.setId(id);
                bizModel.getData().put("id",id);
                bizModel.getData().put("hour",hour.add(hourCount));
                bizModel.setModifiedTime(new Date());
                bizModel.setModifier(creater.getId());

            }else {

                bizModel.getData().put("hour",hour);
                bizModel.setCreatedTime(new Date());
                bizModel.setCreater(creater.getId());
                bizModel.setCreatedDeptId(bizObject.getCreatedDeptId().getId());
                bizModel.setOwner(creater.getId());
                bizModel.setOwnerDeptId(bizObject.getCreatedDeptId().getId());

            }


            getBizObjectFacade().saveBizObject(creater.getId(), bizModel, true);

        }else{
            log.info("引擎调用失败....");
        }

    }


}
*/
